﻿@model WebShop.Models.BaseModel
           
@{
    string generalUrl = Request.CurrentExecutionFilePath;
    System.Text.StringBuilder sBuilder = new System.Text.StringBuilder();
    sBuilder.Append(generalUrl);
    int language_delimiter = 0;
    foreach (string item in Request.QueryString.AllKeys)
    {
        
        if (item == "language")
        {
            language_delimiter = 1;
            continue;
        }
        
        string parameter = ((sBuilder.Length == generalUrl.Length) ? "?" : "&") + item + "=" + Request.QueryString[item];
        sBuilder.Append(parameter);
    }
    generalUrl = sBuilder.ToString();
 
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@Model.Title</title>
    <link href="@Url.Content("~/static/css/bootstrap.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/static/css/bootstrap-responsive.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/static/css/main.css")" rel="stylesheet" type="text/css" />
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="@Url.Content("~/static/js/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/static/js/modernizr-1.7.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/static/js/bootstrap.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/static/js/bootstrap-dropdown.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/static/js/jquery.notifier.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/static/js/jquery.validate.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $(".dropdown-toggle").dropdown();
                                    @foreach (WebShop.Classes.Messaging.Message item in Model.Messages)
                                    {
                                        <text>$('<p>@item.Text</p>').notify({type: "@item.TypeText"});</text>
                                    }
        });
    </script>

    <link rel="shortcut icon" href="@Url.Content("~/static/img/favicon.ico")">
</head>
<body>

    <div class="page">
        <header>
            <div class="navbar navbar-fixed-top">
                <div class="navbar-inner">
                    <div class="container"> 
     
                        <!-- Be sure to leave the brand out there if you want it shown -->
                        <a class="brand" href="/">{<span style="color:Red;">Shop</span>Було}</a>
     
                        <!-- Everything you want hidden at 940px or less, place within here -->
                        <div class="nav-collapse">    
                        
                            @Html.Partial("_LogOnPartial")                                                                  

                            <ul class="nav pull-right">
                                <li class="dropdown"><a href="#"class="dropdown-toggle" data-toggle="dropdown">@Model.Translate("language")<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    @foreach (var item in Model.Languages)
                                    {
                                        string url = generalUrl + ((Request.QueryString.Count == language_delimiter) ? "?" : "&") + "language=" + item.Key;
                                        <li><a href="@url">@item.Value</a></li>
                                    }
                                </ul>
                            </ul>

                            <ul class="nav pull-right">
                                <li><a href="@Url.RouteUrl("Default", new RouteValueDictionary { { "controller", "cart" }, { "action", "index" },})">@Model.Translate("cart")</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </header>
        <section id="main">
            <div class="container">
                <div class="subnav">
                    <ul class="nav nav-pills">
                    @foreach (var item in Model.CategoryTree) {
                        if (item.Sub.Count != 0) {
                      
                            <li class="dropdown">
                                <a href="#" data-toggle="dropdown" class="dropdown-toggle">@item.Item.Name<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                @foreach(var sub in item.Sub) {
                                  <li><a href="@Url.RouteUrl("Category", new RouteValueDictionary { { "id", sub.Id } })">@sub.Name</a></li>
                                }
                                </ul>
                            </li>
                      
                      }else {
                            <li><a href="@Url.RouteUrl("Category", new RouteValueDictionary { { "id", item.Item.Id } })">@item.Item.Name</a></li>
                      }
                    }
                    </ul>
                  </div>
            @RenderBody()</div>
        </section>
        <footer>
        </footer>
    </div>

</body>
</html>
